#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <stdlib.h>

int main()
{
    //close(1);
   // close(0);

    int fd = open("721.log", O_RDONLY);
    //int fd = open("721.log", O_WRONLY | O_CREAT | O_TRUNC, 0666);
    if(fd < 0)
    {
        perror("open");
        exit(1);
    }
    
    dup2(fd, 0);

    char buff[1024];
    fread(buff, 1, 1024, stdin);
    //read(0, buff, 1024);
    printf("%s\n",buff);


    //fprintf(stdout,"fd:%d\n",fd);
   // fprintf(stdout,"stdout fd:%d\n", stdout->_fileno);
   // fflush(stdout);
    
    close(fd);
 //   char buff[1024];
 //   size_t s =  read(0, buff, 1024);
 //   if(s>0)
 //   {
 //       buff[s - 1] = 0;
 //       //printf("%s", buff);
 //       write(1, buff, strlen(buff));
 //   }
    return 0;
}
